const children = [

];
const routes = [

    //访问路由“/”,自动重定向到"/home"
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('@/views/staff/login/login.vue')
    },
    {
        path: '/home',
        name: 'Home',
        component: () => import('@/views/staff/home/home.vue'),
        children
    },
    {
        path: '/chapter',
        name: 'Chapter',
        component: () => import('@/views/staff/chapter/chapter.vue')
    },
    {
        path: '/comment',
        name: 'Comment',
        component: () => import('@/views/staff/comment/comment.vue')
    },
    {
        path: '/404',
        name: "NotFound",
        component: () => import('@/views/404.vue')
    }

];

export const existsRoute = (path) => {
    for (let i = 0; i < routes.length; i++) {
        const r = routes[i];
        if (r.path == path) {
            return true;
        }
        if (r.children && r.children.length) {
            for (let k = 0; k < r.children.length; k++) {
                const sr = r.children[k];
                if (sr.path == path) {
                    return true;
                }
            }
        }
    }
    return false;
};

export default routes;